/*
 * Copyright© 2003-2019 浙江汇信科技有限公司, All Rights Reserved. 
 */
package com.icinfo.cloud.provider.punish.csource.manage.controller;

import com.icinfo.cloud.provider.common.constant.Constant;
import com.icinfo.cloud.provider.punish.csource.manage.dto.CaseSourceLegalInfoUpdateDto;
import com.icinfo.cloud.provider.punish.csource.manage.dto.CaseSourcePartyInfoAdjustDto;
import com.icinfo.cloud.provider.punish.csource.manage.service.ICaseSourcePartyInfoService;
import com.icinfo.cloud.provider.punish.csource.manage.vo.CaseSourcePartyInfoOfCheckVo;
import com.icinfo.cloud.provider.punish.csource.manage.vo.CaseSourcePartyInfoVo;
import com.icinfo.cloud.provider.punish.csource.manage.vo.CaseSourcePartyMsgVo;
import com.icinfo.framework.common.web.Result;
import com.icinfo.framework.core.web.BaseController;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 【V1.4.0】描述: 案源线索当事人信息表（含个人+法人） case_source_party_info 对应的Controller类.<br>
 *
 * @author framework generator
 * @date 2022年08月12日
 */
@Slf4j
@RestController
@RequestMapping("/punish/csource/manage/party")
public class CaseSourcePartyInfoController extends BaseController {

    @Resource
    private ICaseSourcePartyInfoService caseSourcePartyInfoService;

    /**
     * 【V1.4.0】描述： 根据id删除当事人
     *
     * @author: zhengqiang
     * @date: 2022/8/15
     * @param: id
     * @return {@link Result}
     **/
    @GetMapping("/delCaseSourcePartyInfo")
    public Result delCaseSourcePartyInfo(@RequestParam String id) {
        return caseSourcePartyInfoService.delCaseSourcePartyInfo(id);
    }

    /**
     * 【V1.4.0】描述： 调整当事人
     *
     * @author: zhengqiang
     * @date: 2022/8/15
     * @param: caseSourcePartyInfoAdjustDto
     * @return {@link Result}
     **/
    @PostMapping("/updateCaseSourcePartyInfo")
    public Result updateCaseSourcePartyInfo(@RequestBody @Validated CaseSourcePartyInfoAdjustDto caseSourcePartyInfoAdjustDto) {
        return caseSourcePartyInfoService.updateCaseSourcePartyInfo(caseSourcePartyInfoAdjustDto);
    }


    /**
     * 【V1.4.0】描述： 查询案源当事人列表(案源登记)
     *
     * @param: caseSourceId
     * @return {@link List< CaseSourcePartyInfoVo>}
     **/
    @GetMapping("/getCaseSourcePartyInfo")
    public Result<List<CaseSourcePartyInfoVo>> getCaseSourcePartyInfo(@RequestParam String caseSourceId){
        List<CaseSourcePartyInfoVo> caseSourcePartyInfo = caseSourcePartyInfoService.getCaseSourcePartyInfo(caseSourceId);
        return Result.success(Constant.STRING_GET_SUCCESS, caseSourcePartyInfo);
    }

    /**
     * 【V1.4.0】描述： 查询案源当事人列表(案源登记)
     *
     * @param: caseSourceId
     * @return {@link List< CaseSourcePartyInfoVo>}
     **/
    @GetMapping("/getCaseSourcePartyInfoList")
    public Result<List<CaseSourcePartyMsgVo>> getCaseSourcePartyInfoList(@RequestParam String caseSourceId){
        List<CaseSourcePartyMsgVo> caseSourcePartyInfo = caseSourcePartyInfoService.getCaseSourcePartyInfoList(caseSourceId);
        return Result.success(Constant.STRING_GET_SUCCESS, caseSourcePartyInfo);
    }

    /**
     * 【V1.4.0】描述： 查询案源当事人列表(检查转案源)
     *
     * @author: zhengqiang
     * @date: 2022/8/15
     * @param: caseSourceId
     * @return {@link List< CaseSourcePartyInfoVo>}
     **/
    @GetMapping("/getCaseSourcePartyInfoOfCheck")
    public Result<CaseSourcePartyInfoOfCheckVo> getCaseSourcePartyInfoOfCheck(@RequestParam String caseSourceId){
        CaseSourcePartyInfoOfCheckVo caseSourcePartyInfo = caseSourcePartyInfoService.getCaseSourcePartyInfoOfCheck(caseSourceId);
        return Result.success(Constant.STRING_GET_SUCCESS, caseSourcePartyInfo);
    }

    /**
     * 【V1.4.0】描述： 补充案源法定代表人证件信息
     *
     * @author: zhengqiang
     * @date: 2022/8/16
     * @param: updateDto
     * @return {@link Result< String>}
     **/
    @PostMapping("/updateCaseSourceLegalInfo")
    public Result<String> updateCaseSourceLegalInfo(@RequestBody @Validated CaseSourceLegalInfoUpdateDto updateDto) {
        return caseSourcePartyInfoService.updateCaseSourceLegalInfo(updateDto);
    }
}